﻿
@{ IList<FCDB.Web.Models.ActivityEntityModel> modelList = (IList<FCDB.Web.Models.ActivityEntityModel>)ViewBag.ActivityCheckLogs;
   IList<FCDB.Entity.FormCheckLog> Checked = new List<FCDB.Entity.FormCheckLog>();
   if (modelList[8].FormCheckLogList !=null)
   {
   foreach (var i in modelList[8].FormCheckLogList)
   {
       if (i.CheckState == 1)
       {
           Checked.Add(i);
       }
   }
   }else
   {
       foreach (var i in modelList[9].FormCheckLogList)
       {
           if (i.CheckState == 1)
           {
               Checked.Add(i);
           }
       }
   }
   
    <tr style="height: 28px; width: 40px;">
        <th style="text-align: center; font-weight: bold; width: 25%">流程步骤</th>
    <th  style="text-align: center; font-weight: bold">第一笔审核意见</th>
    <th  style="text-align: center; font-weight: bold">第二笔审核意见</th>
    <th  style="text-align: center; font-weight: bold">第三笔审核意见</th>
    <th  style="text-align: center; font-weight: bold">第四笔审核意见</th>
    </tr>
 
    foreach (FCDB.Web.Models.ActivityEntityModel item in modelList)
    {
        if (item.CheckState != 0)
        {
            if (item.FormCheckLogList.Count == 1)
            {
    <tr style="height: 28px; width: 40px;@(item == modelList[modelList.Count - 1] ? "display:none" : "")">
        @if (string.IsNullOrEmpty(item.FromDiv))
        {             
            <td>@item.ActivityName</td>
            <td>
                @(item.CheckState == 1 ?  "同意 " : "不同意")<span> @item.CheckContent</span>
                <br />
                <span style="width: 100%; text-align: right;">
                    @item.CheckUserName &nbsp;&nbsp;&nbsp;@item.CheckTime
                </span>
            </td>  
            <td></td> 
            <td></td> 
            <td></td> 
        }
        else
        {
            string FromDiv = "div" + item.FromDiv;
            <td colspan="5" style="padding: 0px;">
                <div id="@FromDiv" class="ProccessActiveContainer"></div>
            </td>
        }
    </tr>
            }
            else
            {
    <tr style="width: 40px; @(item == modelList[modelList.Count - 1] ? "display:none" : "")">
        <td>@item.ActivityName</td>
        <td>
            <table>
                @foreach (var m in item.FormCheckLogList)
                {
                     if ((Checked.Count == 0) || (Checked.Count > 0 && m.CheckTime <= Checked[0].CheckTime))
                                      {
                    <tr style="height: 28px;">
                        <td>
                            @(m.CheckState == 1 ? "同意 " : "不同意")<span> @m.CheckContent</span>
                            <br />
                            <span style="width: 100%; text-align: right;">
                                @m.CheckUserName &nbsp;&nbsp;&nbsp;@m.CheckTime
                            </span>
                        </td>
                    </tr>
                }
                }
            </table>
        </td>
        <td>
            <table>
                @foreach (var m in item.FormCheckLogList)
                {
                     if ((Checked.Count == 1 && m.CheckTime > Checked[0].CheckTime) || (Checked.Count > 1 && m.CheckTime <= Checked[1].CheckTime && m.CheckTime > Checked[0].CheckTime))
                                      {
                    <tr style="height: 28px;">
                        <td>
                            @(m.CheckState == 1 ? "同意 " : "不同意")<span> @m.CheckContent</span>
                            <br />
                            <span style="width: 100%; text-align: right;">
                                @m.CheckUserName &nbsp;&nbsp;&nbsp;@m.CheckTime
                            </span>
                        </td>
                    </tr>
                }
                }
            </table>
        </td>
        <td>
            <table>
                @foreach (var m in item.FormCheckLogList)
                {
                     if ((Checked.Count == 2 && m.CheckTime > Checked[1].CheckTime) || (Checked.Count > 2 && m.CheckTime <= Checked[2].CheckTime && m.CheckTime > Checked[1].CheckTime))
                                      {
                    <tr style="height: 28px;">
                        <td>
                            @(m.CheckState == 1 ? "同意 " : "不同意")<span> @m.CheckContent</span>
                            <br />
                            <span style="width: 100%; text-align: right;">
                                @m.CheckUserName &nbsp;&nbsp;&nbsp;@m.CheckTime
                            </span>
                        </td>
                    </tr>
                }
                }
            </table>
        </td>
        <td>
            <table>
                @foreach (var m in item.FormCheckLogList)
                {
                     if ((Checked.Count == 3 && m.CheckTime > Checked[2].CheckTime) || (Checked.Count > 3 && m.CheckTime <= Checked[3].CheckTime && m.CheckTime > Checked[2].CheckTime))
                                      {
                    <tr style="height: 28px;">
                        <td>
                            @(m.CheckState == 1 ? "同意 " : "不同意")<span> @m.CheckContent</span>
                            <br />
                            <span style="width: 100%; text-align: right;">
                                @m.CheckUserName &nbsp;&nbsp;&nbsp;@m.CheckTime
                            </span>
                        </td>
                    </tr>
                }
                }
            </table>
        </td>
    </tr>
            }
        }
        else
        {
    <tr style="height: 28px; width: 40px; @(item == modelList[modelList.Count - 1] ? "display:none" : "")">
        @if (string.IsNullOrEmpty(item.FromDiv))
        {
            <td>@item.ActivityName</td>
            <td></td>
        }
        else
        {
            string FromDiv = "div" + item.FromDiv;
            <td colspan="2" style="padding: 0px;">
                <div id="@FromDiv" class="ProccessActiveContainer"></div>
            </td>
            
        }
    </tr>
  
        }

    }
}
